package com.love.marriage.userInfo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.love.marriage.common.interfaces.permission.DataPermission;
import com.love.marriage.userInfo.entity.UserInfo;
import com.love.marriage.userInfo.vo.*;
import com.love.marriage.userRechargeRecordInfo.vo.UserRechargeHierarchyQueryParam;
import com.love.marriage.userRechargeRecordInfo.vo.UserRechargeHierarchyVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.util.List;

/**
 * description:  用户表 mapper
 * author:       mybatisPlus
 * createDate:   2024-10-11 22:04:00
 * version:      1.0.0
 */
@Mapper
public interface UserInfoMapper extends BaseMapper<UserInfo> {

    @DataPermission(table = "user_info_t")
    Page<UserInfoVo> getPage(Page<UserInfoVo> page, @Param("userInfoVo") UserInfoVo userInfoVo);

    Page<UserVo> getUserPage(Page<UserVo> page,
                             @Param("userInfoVo") UserSearchInfoVo userInfoVo,
                             @Param("startTime") LocalDate startTime,
                             @Param("endTime") LocalDate endTime,
                             @Param("curUserId") Long curUserId,
                             @Param("type") String list);

    Long getUserCount(@Param("userInfoVo") UserSearchInfoVo userInfoVo,
                      @Param("startTime") LocalDate startTime,
                      @Param("endTime") LocalDate endTime,
                      @Param("curUserId") Long curUserId);

    UserInfoVo queryUserInfo(@Param("id") Long id);

    UserInfoVo queryUserInfoByPhone(@Param("phone") String phone);

    UserVo queryUser(@Param("id") Long id,
                     @Param("type") String type);

    UserVo queryByLocalImId(@Param("localImId") Long localImId,
                            @Param("type") String type);

    UserCountVo queryUserMemberInfo();

    UserCountVo queryUserStatistics();

    List<UserDataUserVo> queryDayUserInfo();

    List<UserInfoVo> queryNoticeUserInfo();

    List<UserInfoVo> getInvite(@Param("userInfoVo") UserInfoVo userInfoVo);
    // 查询用户介绍人

    // 查询用户介绍人及上级
    List<UserInfoVo> queryUserInstrInfo(@Param("userId") Long userId);

    // 查询用户上级合伙人
    List<UserInfoVo> queryUserPartnerInfo(@Param("userId") Long userId);

    UserReduceInfoVo queryUserReduceInfo(@Param("userId") Long userId);

    Page<UserReduceInfoVo> queryUserReduceInfoNew(Page<UserReduceInfoVo> page, @Param("userInfoVo") UserInfoVo userInfoVo);

    Page<UserReduceInfoVo> queryUserReduceDetailInfo(Page<UserReduceInfoVo> page,
                                                     @Param("userInfoVo") UserInfoVo userInfoVo);

    List<UserInfoVo> queryUserList(@Param("userInfoVo") UserInfoVo userInfoVo);

    List<MemberAboutVo> getMemberAboutList(@Param("userId") Long userId);

    List<MemberAboutVo> getMemberAboutListByUserIds(@Param("userIds") List<Long> userIds);

    /**
     * 获取用户所有信息（包含会员、红娘、合伙人、实名认证信息）
     */
    Page<UserInfoVo> getUserAllInfo(Page<UserInfoVo> page, @Param("userAllQueryVo") UserAllQueryVo userAllQueryVo);

    List<UserRechargeHierarchyVo> queryUserRechargeHierarchyList(@Param("param") UserRechargeHierarchyQueryParam param);

    Page<UserRechargeHierarchyVo> queryUserRechargeHierarchyPage(Page<UserRechargeHierarchyVo> page,
                                                                 @Param("param") UserRechargeHierarchyQueryParam param);

    List<InviteCommissionDetailVo> queryInviteTotalCommission(@Param("param") UserRechargeHierarchyQueryParam param);

    List<InviteCommissionDetailVo> queryInviteCommissionDetailList(@Param("param") UserRechargeHierarchyQueryParam param);

    /**
     * 查询当前人身份信息
     * @param userId 用户ID
     * @return 用户身份信息
     */
    UserIdentityInfoVo queryUserIdentityInfo(@Param("userId") Long userId);
}
